<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = 'abcoefoxyozzopp';
        var tem = {};
        for(i = 0; i < arr.length; i++){ //arr[i]
            if(tem[arr[i]]){
                tem[arr[i]] = tem[arr[i]] +1;
            }else {
                tem[arr[i]] = 1;
            }
        }
        console.log(tem);
        for(var k in tem){
            console.log(k + '出现次数' + tem[k])
        }
    </script>
</body>
</html>